Hệ thống quản lý ISP trong PHP
1 <?php
2 // Start from getting the hader which contains some settings we need
3 require_once 'includes/header.php';
4 require_once "includes/classes/admin-class.php";
5 $admins = new Admins($dbh);
6 // Redirect visitor to the login page if he is trying to access
7 // this page without being logged in
8 if (!isset($_SESSION['admin_session']) )
9 {
10 $commons->redirectTo(SITE_PATH.'login.php');
11 }
12 ?>
13 <!-- <button disabled="disabled" class="btn btn-success">Generate Now</button> -->
14 <div class="dashboard">
15 <div class="col-md-12 col-sm-12">
16 <div class="col-md-6">
17 <!-- <h4>Customer Billing: Month of October</h4> -->
18 <a href='paid_bills.php' class="btn btn-primary">Paid Bills</a>
19 </div>
20 <div class="col-md-6">
21 <form class="form-inline pull-right">
22 <div class="form-group">
23 <label class="sr-only" for="search">Search for</label>
24 <div class="input-group">
25 <div class="input-group-addon"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></div>
26 <input type="text" class="form-control" id="search" placeholder="Type a name">
27 <div class="input-group-addon"></div>
28 </div>
29 </div>
30 </form>
31 <a href='bill_generation.php' class="btn btn-success pull-right">Generate Now</a>
32
33 </div>
34 <br><br>
35
36 </div>
37 <div class="col-md-12 col-sm-12" id="bill_table">
38 <?php
39 $billing = $admins->fetchBilling();
40 if (isset($billing) && sizeof($billing) > 0){ ?>
41 <table class="table table-striped table-bordered">
42 <thead class="thead-inverse">
43 <tr class="info">
44 <th>ID </th>
45 <th>Name</th>
46 <th>Generated on</th>
47 <th>Package</th>
48 <th>Months</th>
49 <th>Amounts</th>
50 <th>Payment / Receipt</th>
51 </tr>
52 </thead>
53 <tbody>
54 <?php
55 foreach ($billing as $bill) {
56 $client_id = $bill->customer_id;
57 $customer_info = $admins->getCustomerInfo($client_id);
58 $customer_name = $customer_info->full_name;
59 $package_id = $customer_info->package_id;
60 $packageInfo = $admins->getPackageInfo($package_id);
61 $package_name = $packageInfo->name;
62 ?>
63 <tr>
64 <td scope="row"><?=$bill->id?></td>
65 <td><?=$customer_name?></td>
66 <td><?=$bill->g_date?></td>
67 <td><?=$package_name?></td>
68 <td><?=$bill->months?></td>
69 <td><?=$bill->total?></td>
70 <td><button type="button" onClick=pay(<?=$client_id?>) class="btn btn-info">Pay</button> <button onClick=bill(<?=$client_id?>) type="button" class="btn btn-info">Bill</button></td>
71 </tr>
72 <?php
73 }
74 }else{
75 ?>
76 <h1>Congratulations ! No due is left to be paid !</h1>
77 <?php
78 }
79 ?>
80 </tbody>
81 </table>
82 <div>
83 </div>
84
85 </div>
86 </div>
87
88 <?php include 'includes/footer.php'; ?>
89 <script type="text/javascript">
90 document.getElementById('date').valueAsDate = new Date();
91 function pay(id) {
92 let left = (screen.width/2)-(600/2);
93 let top = (screen.height/2)-(800/2);
94 let params = `scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=600,height=800,left=${left},top=${top}`;
95 open('pay.php?customer='+id, 'Hello World !', params)
96 }
97 function bill(id) {
98 let left = (screen.width/2)-(600/2);
99 let top = (screen.height/2)-(800/2);
100 let params = `scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=600,height=800,left=${left},top=${top}`;
101 open('bill.php?customer='+id, 'Hello World !', params)
102 }
103 </script>